<template>
	<view class="consult">
		<view class="head">
			<image class="bg" :src="$buildFullImageUrl('/static/consult/head-bg.png')"></image>
			<view class="con">
				<view>测评</view>
				<view>
					<image :src="$buildFullImageUrl('/static/evaluate/search.svg')" @click="handelSearch"></image>
					<image :src="$buildFullImageUrl('/static/evaluate/heart-little.svg')" @click="handelMyEvaluate"></image>
				</view>
			</view>
		</view>
		<view class="box-con">
			<cc-twoCate ref="twoCate" :classList="categoryList" :currentTypeId="currentTypeId" :hideShow="true" @itemClick="itemClick" @itemClickDetail="itemClickDetail"></cc-twoCate>
		</view>
	</view>
</template>

<script>
import { getCategoryList } from '@/api/evaluate/index.js';
export default {
	data() {
		return {
			categoryList: [],
			currentTypeId: 0
		};
	},
	components: {},
	created() {
		
	},
	onShareAppMessage() {
	  return {
	    title: '百灵心理',
	    // ...其他配置
	  };
	},
	onShow() {
		getCategoryList().then(res=>{
			// console.log(res);
			this.categoryList = res.rows;
			this.currentTypeId = this.categoryList[0].id
			this.$refs.twoCate.refreshList()
		})
		
	},
	methods: {
		
		itemClickDetail(item) {
			//获取点击的列表项
			this.$tab.navigateTo(`/subset/pages/evaluate/evaluateDetail?id=${item.id}`);
		},

		itemClick(e) {
			//点击的左侧类型
			this.currentTypeId = e.id;
		},
		handelSearch(){
			this.$tab.navigateTo(`/subset/pages/evaluate/search/index`);
		},
		handelMyEvaluate(){
			this.$tab.navigateTo(`/subset/pages/evaluate/search/myEvaluate`);
		}
	},
	// onHide() {
	// 	console.log(111);
	// 	this.currentTypeId = 0;
	// }

};
</script>

<style scoped lang="scss">
.consult {
	width: 100%;
	height: 100%;
	background-color: #f5f4f8;
	.scrollWrap {
		width: 100%;
		height: 100%;
	}
	.head {
		width: 100%;
		height: 88rpx;
		position: relative;

		.bg {
			width: 100%;
			height: 100%;
			position: absolute;
			left: 0;
			top: 0;
		}

		.con {
			width: 100%;
			height: 100%;
			position: absolute;
			left: 0;
			top: 0;
			padding: 24rpx 60rpx;
			box-sizing: border-box;
			display: flex;
			justify-content: space-between;
			align-items: center;

			> view:nth-child(1) {
				font-weight: bold;
				font-size: 32rpx;
				color: #333333;
			}

			> view:nth-child(2) {
				image:nth-child(1) {
					width: 37rpx;
					height: 40rpx;
					margin-right: 60rpx;
				}

				image:nth-child(2) {
					width: 36rpx;
					height: 39rpx;
				}
			}
		}
	}
	.content {
		display: flex;
		flex-direction: column;
	}
	.box-con {
		width: 100%;
		height: calc(100% - 88rpx);
		position: relative;
	}
}
</style>
